from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import pymysql
from redis import StrictRedis



app = Flask(__name__)


class Config:
    # 设置同名的类属性
    DEBUG = True  # 设置调试模式
    SQLALCHEMY_DATABASE_URI="mysql+pymysql://root:123456@127.0.0.1:3306/info17" # 设置数据库连接地址
    SQLALCHEMY_TRACK_MODIFICATIONS = False # 是否追踪数据库变化
    REDIS_HOST = "127.0.0.1" # redis 数据库的ip
    REDIS_PORT = 6379


app.config.from_object(Config)
# 创建数据库连接
db = SQLAlchemy(app)
# 创建redis连接
sr = StrictRedis(host=Config.REDIS_HOST,port=Config.REDIS_PORT)


@app.route('/')
def index():
    sr.set('name',"zs")
    return 'hell111o'



if __name__ == '__main__':
    app.run(debug=True)

